package gof_003_行为型_Behavioral.gof_005_责任链_ChainOfResponsibility.gof_004_Chain;

/**
 * 用户
 */
public class Role_User implements Role_Takeout{
    private int status;

    public Role_User(int status) {
        this.status = status;
        switch (status) {
            case 1:
                chooseFood();
                break;
            case 2:
                shoppingCart();
                break;
            default:
                break;
        }
    }

    /**
     * 选购食品
     */
    public void chooseFood() {
        this.status = 0;
        System.out.println("用户选购...");
        Utils.sleep(1);

        int i = Utils.scanner("请选择是否付款：[1]放弃付款\t[2]付款");
        if (i == 1) {
            System.out.println("用户未付款！");

            new Role_User(2);
            return;
        } else if (i == 2) {
            System.out.println("用户付款!");

            new Role_MeiTuan(3);
        }
    }



    /**
     * 加入购物车
     */
    private void shoppingCart() {
        System.out.println("已经将食品添加到购物车...");
    }

    /**################################ 分割线 ################################*/

}